let ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractLESS = new ExtractTextPlugin('style/[name].css');
const path = require("path");
 const webpack = require('webpack');
module.exports={
  entry:__dirname+"/app/index.js",
  output:{
    filename:"boudle.js",
    path:__dirname+"/public/"
  },
  module:{
      rules:[
        {
          test:/\.js|\.jsx$/,
          use:{
              loader:"babel-loader",
              options: {
                        presets: ['es2015', 'react'],
                    }
          },
          exclude:/node_modules/
        },
        {
          test:/\.less$/,
          use: extractLESS.extract([ 'css-loader', 'less-loader','postcss-loader' ])
        }
      ]
  },
  devServer:{
    host: 'localhost', //可选，ip
    port: 3000, //可选，端口
    contentBase:path.resolve(__dirname,'public'), //可选，基本目录结构
    compress: true //可选，压缩
},
    plugins:  [
      extractLESS
  ]
}
